include_directories(${PROJECT_SOURCE_DIR}/include)

find_library(LIBUSBVAL usb-1.0)
if(LIBUSBVAL)
    message(STATUS "libusb library has been found")
else(LIBUSBVAL)
    message(FATAL_ERROR "can not find libusb or version < 1.0")
endif(LIBUSBVAL)

find_library(PROTOBUF protobuf)
if(PROTOBUF)
    message(STATUS "protobuf has been found")
else()
    message(FATAL_ERROR "can not find protobuf")
endif()

add_library(attachRev SHARED attachRev.cpp) 
target_link_libraries(attachRev usb-1.0)
set_target_properties(attachRev PROPERTIES 
    LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib
    VERSION 1.0 SOVERSION 1)

add_executable(senslayer main.cpp ${PROJECT_SOURCE_DIR}/proto/rawdata.pb.cc simpleSocket.cpp)
target_link_libraries(senslayer attachRev protobuf)
set_target_properties(senslayer PROPERTIES 
    RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin )
